inherited crdTenantPropis: TcrdTenantPropis
  Left = 515
  Top = 465
  VertScrollBar.Range = 0
  BorderStyle = bsDialog
  Caption = #1054#1087#1077#1088#1072#1094#1080#1080' '#1089' '#1087#1088#1086#1087#1080#1089#1082#1086#1081
  ClientHeight = 328
  ClientWidth = 392
  Constraints.MinHeight = 355
  Constraints.MinWidth = 400
  OldCreateOrder = True
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited Panel1: TPanel
    Top = 301
    Width = 392
    inherited BitBtn1: TBitBtn
      Left = 185
    end
    inherited BitBtn2: TBitBtn
      Left = 287
    end
  end
  inherited ToolBar1: TToolBar
    Width = 392
  end
  object gbAddress: TGroupBox [2]
    Left = 0
    Top = 145
    Width = 392
    Height = 156
    Align = alClient
    Caption = ' '#1053#1086#1074#1099#1081' '#1089#1090#1072#1090#1091#1089' '
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 2
    object Label6: TLabel
      Left = 35
      Top = 46
      Width = 34
      Height = 13
      Alignment = taRightJustify
      Caption = #1057#1090#1072#1090#1091#1089
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
    end
    object Label5: TLabel
      Left = 32
      Top = 90
      Width = 37
      Height = 13
      Alignment = taRightJustify
      Caption = #1087#1086' '#1076#1072#1090#1091
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
    end
    object Label12: TLabel
      Left = 35
      Top = 68
      Width = 34
      Height = 13
      Alignment = taRightJustify
      Caption = #1089' '#1076#1072#1090#1099
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
    end
    object Label7: TLabel
      Left = 38
      Top = 22
      Width = 31
      Height = 13
      Alignment = taRightJustify
      Caption = #1040#1076#1088#1077#1089
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
    end
    object Label8: TLabel
      Left = 177
      Top = 68
      Width = 172
      Height = 13
      Caption = #1086#1073#1103#1079#1072#1090#1077#1083#1100#1085#1086' '#1076#1083#1103' '#1055#1047', '#1042#1059', '#1042#1047
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clRed
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = [fsBold]
      ParentFont = False
      WordWrap = True
    end
    object Label9: TLabel
      Left = 177
      Top = 90
      Width = 183
      Height = 13
      Caption = #1086#1073#1103#1079#1072#1090#1077#1083#1100#1085#1086' '#1076#1083#1103' '#1042#1067#1055', '#1042#1059', '#1042#1047
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clRed
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = [fsBold]
      ParentFont = False
      WordWrap = True
    end
    object Label1: TLabel
      Left = 6
      Top = 110
      Width = 63
      Height = 13
      Alignment = taRightJustify
      Caption = #1055#1088#1080#1084#1077#1095#1072#1085#1080#1077
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      ParentFont = False
    end
    object dteClientStatusEnd: TDBDateTimeEditEh
      Left = 75
      Top = 87
      Width = 95
      Height = 19
      AlwaysShowBorder = True
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      Kind = dtkDateEh
      ParentFont = False
      ParentShowHint = False
      ShowHint = True
      TabOrder = 3
      Visible = True
    end
    object dteClientStatusStart: TDBDateTimeEditEh
      Left = 75
      Top = 65
      Width = 95
      Height = 19
      AlwaysShowBorder = True
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      Kind = dtkDateEh
      ParentFont = False
      ParentShowHint = False
      ShowHint = True
      TabOrder = 2
      Visible = True
    end
    object lcbNewStatus: TDBLookupComboboxEh
      Left = 75
      Top = 43
      Width = 95
      Height = 19
      AlwaysShowBorder = True
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      KeyField = 'RSTATUS'
      ListField = 'RSATUS_NAME'
      ListSource = dscListStatus
      ParentFont = False
      ParentShowHint = False
      ShowHint = True
      TabOrder = 1
      Visible = True
      OnChange = lcbNewStatusChange
    end
    object dbeNewAddress: TDBEditEh
      Left = 75
      Top = 21
      Width = 255
      Height = 19
      AlwaysShowBorder = True
      Color = clInactiveCaptionText
      DataField = 'ADDRESS'
      DataSource = dscGetAbonAddress
      EditButtons = <>
      Flat = True
      ReadOnly = True
      TabOrder = 0
      Visible = True
    end
    object dbeNote: TDBEditEh
      Left = 75
      Top = 109
      Width = 314
      Height = 44
      AlwaysShowBorder = True
      AutoSize = False
      EditButtons = <>
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Flat = True
      ParentFont = False
      TabOrder = 4
      Visible = True
      WordWrap = True
    end
  end
  object GroupBox1: TGroupBox [3]
    Left = 0
    Top = 29
    Width = 392
    Height = 116
    Align = alTop
    Caption = ' '#1058#1077#1082#1091#1097#1080#1081' '#1089#1090#1072#1090#1091#1089' '
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 3
    object dbg_CurrentStatus: TDBGridEh
      Left = 2
      Top = 15
      Width = 388
      Height = 99
      Align = alClient
      DataGrouping.GroupLevels = <>
      DataSource = dscCurrentStatus
      Flat = True
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      FooterColor = clWindow
      FooterFont.Charset = DEFAULT_CHARSET
      FooterFont.Color = clWindowText
      FooterFont.Height = -11
      FooterFont.Name = 'MS Sans Serif'
      FooterFont.Style = [fsBold]
      Options = [dgTitles, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgConfirmDelete, dgCancelOnExit]
      OptionsEh = [dghFixed3D, dghHighlightFocus, dghClearSelection, dghDblClickOptimizeColWidth, dghDialogFind, dghColumnResize, dghColumnMove]
      ParentFont = False
      ReadOnly = True
      RowDetailPanel.Color = clBtnFace
      TabOrder = 0
      TitleFont.Charset = DEFAULT_CHARSET
      TitleFont.Color = clWindowText
      TitleFont.Height = -11
      TitleFont.Name = 'MS Sans Serif'
      TitleFont.Style = []
      UseMultiTitle = True
      VTitleMargin = 5
      Columns = <
        item
          EditButtons = <>
          FieldName = 'ADDRESS'
          Footers = <>
          Width = 179
        end
        item
          EditButtons = <>
          FieldName = 'STATUS_NAME'
          Footers = <>
        end
        item
          EditButtons = <>
          FieldName = 'RDOCDATE'
          Footers = <>
        end
        item
          EditButtons = <>
          FieldName = 'REDATE'
          Footers = <>
        end>
      object RowDetailData: TRowDetailPanelControlEh
      end
    end
  end
  inherited ActionList1: TActionList
    inherited aSave: TAction
      OnExecute = aSaveExecute
    end
    inherited aCancel: TAction
      OnExecute = aCancelExecute
    end
  end
  inherited PropStorage: TPropStorageEh
    Section = 'crdTenantPropis'
  end
  object dsGetAbonAddress: TpFIBDataSet
    SelectSQL.Strings = (
      'select address,'
      
        '       (select rstatus from proc_client_get_status (:pclient_id,' +
        ' current_date, a.id)) as addr_status'
      '  from v_abons a '
      '  where a.id = :pabonent_id')
    BeforeOpen = dsGetAbonAddressBeforeOpen
    Transaction = trTenantNew
    Database = MAINDM.pMainDatabase
    Left = 308
    Top = 161
    object dsGetAbonAddressADDRESS: TFIBStringField
      FieldName = 'ADDRESS'
      Size = 245
      EmptyStrToNull = True
    end
    object dsGetAbonAddressADDR_STATUS: TFIBIntegerField
      FieldName = 'ADDR_STATUS'
    end
  end
  object trTenantNew: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    Left = 282
    Top = 95
  end
  object dsListStatus: TpFIBDataSet
    SelectSQL.Strings = (
      'SELECT'
      '    RSTATUS,'
      '    RSATUS_NAME'
      'FROM'
      
        '    PROC_CLIENT_GET_ALLOW_STATUS(:PCURRENT_STATUS, :pclient_id, ' +
        ':pdate) ')
    BeforeOpen = dsListStatusBeforeOpen
    Transaction = trTenantNew
    Database = MAINDM.pMainDatabase
    Left = 310
    Top = 193
    oFetchAll = True
    object dsListStatusRSTATUS: TFIBIntegerField
      FieldName = 'RSTATUS'
    end
    object dsListStatusRSATUS_NAME: TFIBStringField
      FieldName = 'RSATUS_NAME'
      Size = 30
      EmptyStrToNull = True
    end
  end
  object dscListStatus: TDataSource
    DataSet = dsListStatus
    Left = 342
    Top = 193
  end
  object spSetClientStatus: TpFIBStoredProc
    Transaction = trTenantNew
    Database = MAINDM.pMainDatabase
    SQL.Strings = (
      'EXECUTE PROCEDURE PROC_CLIENT_SET_STATUS'
      '(:PCLIENT_ID,'
      '    :PABONENT_ID,'
      '    :PSTATUS,'
      '    :PDATE_1,'
      '    :PDATE_2,'
      '    :PNOTE)')
    StoredProcName = 'PROC_CLIENT_SET_STATUS'
    Left = 360
    Top = 99
    qoAutoCommit = True
    qoStartTransaction = True
  end
  object dscGetAbonAddress: TDataSource
    DataSet = dsGetAbonAddress
    Left = 340
    Top = 161
  end
  object dsCurrentStatus: TpFIBDataSet
    SelectSQL.Strings = (
      'select first(1) p.rdocdate, p.redate, rabonent_id, '
      '       coalesce(p.rstatus, 0) as rstatus,'
      '       (select v.address from v_abons v'
      '          where v.id = p.rabonent_id) as address,'
      '       (select first(1) d.status_name '
      '          from clients_oper_types d '
      '          where d.status_code = p.rstatus) as status_name'
      
        '  from proc_client_get_status (:pclient_id, current_date, null) ' +
        'p'
      
        '  order by (case p.rstatus when 1 then 0 when 2 then 1 when 3 th' +
        'en 4 else 5 end), rdocdate desc')
    BeforeOpen = dsCurrentStatusBeforeOpen
    Transaction = trTenantNew
    Database = MAINDM.pMainDatabase
    Left = 280
    Top = 41
    object dsCurrentStatusRDOCDATE: TFIBDateField
      DisplayLabel = #1044#1072#1090#1072' '#1085#1072#1095#1072#1083#1072
      FieldName = 'RDOCDATE'
    end
    object dsCurrentStatusREDATE: TFIBDateField
      DisplayLabel = #1044#1072#1090#1072' '#1086#1082#1086#1085#1095#1072#1085#1080#1103
      FieldName = 'REDATE'
    end
    object dsCurrentStatusRABONENT_ID: TFIBIntegerField
      FieldName = 'RABONENT_ID'
    end
    object dsCurrentStatusRSTATUS: TFIBIntegerField
      FieldName = 'RSTATUS'
    end
    object dsCurrentStatusADDRESS: TFIBStringField
      DisplayLabel = #1040#1076#1088#1077#1089
      DisplayWidth = 25
      FieldName = 'ADDRESS'
      Size = 245
      EmptyStrToNull = True
    end
    object dsCurrentStatusSTATUS_NAME: TFIBStringField
      DisplayLabel = #1057#1090#1072#1090#1091#1089
      DisplayWidth = 8
      FieldName = 'STATUS_NAME'
      Size = 10
      EmptyStrToNull = True
    end
  end
  object dscCurrentStatus: TDataSource
    DataSet = dsCurrentStatus
    Left = 312
    Top = 41
  end
  object dsGetAllowDate: TpFIBDataSet
    SelectSQL.Strings = (
      'SELECT'
      '    RALLOW_BDATE,'
      '    RALLOW_EDATE'
      'FROM'
      '    PROC_CLIENT_GET_ALLOW_DATE(:PNEW_STATUS,'
      '    :POLD_STATUS) ')
    Transaction = trTenantNew
    Database = MAINDM.pMainDatabase
    Left = 310
    Top = 225
    oFetchAll = True
    object dsGetAllowDateRALLOW_BDATE: TFIBSmallIntField
      FieldName = 'RALLOW_BDATE'
    end
    object dsGetAllowDateRALLOW_EDATE: TFIBSmallIntField
      FieldName = 'RALLOW_EDATE'
    end
  end
  object dscGetAllowDate: TDataSource
    DataSet = dsGetAllowDate
    Left = 342
    Top = 225
  end
end
